//
//  MZY_TableCell.m
//  FullHouse
//
//  Created by dllo on 16/1/20.
//  Copyright © 2016年 yy. All rights reserved.
//

#import "MZY_TableCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
#define HORIZONTAL [UIScreen mainScreen].bounds.size.width / 414
#define VERTICAL [UIScreen mainScreen].bounds.size.height / 736

@implementation MZY_TableCell

- (void)dealloc
{
    [self.backView release];
    [self.pictureImageView release];
    [self.titleLabel release];
    [self.messageImageView release];
    [self.messageLabel release];
    [self.viewImageView release];
    [self.viewLabel release];
    [self.textField release];
    [self.authorImageView release];
    [self.introduceLabel release];
    [super dealloc];
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView{
    
    self.contentView.backgroundColor = [UIColor cyanColor];
    
    self.backView = [[UIView alloc]init];
    self.backView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.backView];
    [self.backView release];
    
    self.pictureImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.pictureImageView];
    [self.pictureImageView release];
    
    self.titleLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.titleLabel];
    [self.titleLabel release];
    
    self.messageImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.messageImageView];
    [self.messageImageView release];
    
    self.messageLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.messageLabel];
    [self.messageLabel release];
    
    self.viewImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.viewImageView];
    [self.viewImageView release];
    
    self.viewLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.viewLabel];
    [self.backView release];
    
    self.textField = [[UITextField alloc]init];
    self.textField.backgroundColor = [UIColor lightGrayColor];
    [self.backView addSubview:self.textField];
    [self.textField release];
    
    self.authorImageView = [[UIImageView alloc]init];
    [self.backView addSubview:self.authorImageView];
    [self.authorImageView release];
    
    self.introduceLabel = [[UILabel alloc]init];
    [self.backView addSubview:self.introduceLabel];
    [self.introduceLabel release];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.backView.frame = CGRectMake(0, 10 * VERTICAL, WIDTH, HEIGHT - 10 * VERTICAL);
    self.pictureImageView.frame = CGRectMake(0, 0, 110 * HORIZONTAL, 120 * VERTICAL);
    self.titleLabel.frame = CGRectMake(120 * HORIZONTAL, 10 * VERTICAL, WIDTH - 130 * HORIZONTAL, 20 * VERTICAL);
    self.messageImageView.frame = CGRectMake(120 * HORIZONTAL, 40 * VERTICAL, 20 * HORIZONTAL, 20 * HORIZONTAL);
    self.messageLabel.frame = CGRectMake(150 * HORIZONTAL, 40 * VERTICAL, 20 * HORIZONTAL, 20 * HORIZONTAL);
    self.viewImageView.frame = CGRectMake(190 * HORIZONTAL, 40 * VERTICAL, 20 * HORIZONTAL, 20 * HORIZONTAL);
    self.viewLabel.frame = CGRectMake(220 * HORIZONTAL, 40 * VERTICAL, 40 * HORIZONTAL, 20 * VERTICAL);
    self.textField.frame = CGRectMake(120 * HORIZONTAL, 65 * VERTICAL, WIDTH - 130 * HORIZONTAL, 1);
    self.authorImageView.frame = CGRectMake(120 * HORIZONTAL, 75 * VERTICAL, 40 * HORIZONTAL, 40 * HORIZONTAL);
    self.introduceLabel.frame = CGRectMake(180 * HORIZONTAL, 90 * VERTICAL, 200 * HORIZONTAL, 20 * VERTICAL);
}

@end
